package com.woniuxy.center.controller;


import com.woniuxy.center.entity.PersonCollections;
import com.woniuxy.center.service.PersonCollectionsService;
import com.woniuxy.center.vo.PersonalCollectionVO;
import com.woniuxy.life.core.api.CommonResult;
import com.woniuxy.life.core.api.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 个人中心收藏表 前端控制器
 * </p>
 *
 * @author 邓粟天，高君诚
 * @since 2020-09-24
 */
@RestController
@RequestMapping("/center/person-collections")
public class PersonCollectionsController {

    @Autowired
    PersonCollectionsService personCollectionsService;

    @GetMapping("/getAll/{log}")
    @ResponseBody
    public CommonResult getAllCollections(@RequestParam(value = "currentPage",defaultValue = "1") Integer currentPage, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @PathVariable("log") Integer log, PersonCollections personCollections){

        try {
            String type = "";
            switch (log){
                case 1:
                    type = "COLLECTIONSHOP_ID";
                case 2:
                    type = "COLLECTION_ID";
                case 3:
                    type = "COLLECTS_ID";
            }
            CommonResult<PersonalCollectionVO> personalCollectionVO = new CommonResult<>();
            PersonalCollectionVO collectionVO = personCollectionsService.collection_query(currentPage,pageSize,personCollections);
            personalCollectionVO.setCode(ResultCode.SUCCESS.getCode());
            personalCollectionVO.setMessage(ResultCode.SUCCESS.getMessage());
            personalCollectionVO.setData(collectionVO);
        }
        catch (Exception e){

        }

        return null;
    }

}
